#! /usr/bin/env python
# -*- coding: utf-8 -*-


"""
Definition of TreeNode:
class TreeNode:
    def __init__(self, val):
        self.val = val
        self.left, self.right = None, None
"""

class Solution:
    """
    @param root: param root: The root of the binary search tree
    @param k1: An integer
    @param k2: An integer
    @return: return: Return all keys that k1<=key<=k2 in ascending order
    """
    def searchRange(self, root, k1, k2):
        self.results = []       # 使用实例变量来共享数据
        self._range_of_root(root, k1, k2)

        return self.results

    def _range_of_root(self, root, k1, k2):
        if not root:
            return

        self._range_of_root(root.left, k1, k2)

        if k1 <= root.val <= k2:
            self.results.append(root.val)

        self._range_of_root(root.right, k1, k2)

def main():
    print("start main")

if __name__ == "__main__":
    main()
